import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;

public class QiNiu {

	public static void main(String[] args) throws Exception {
		String parm = args[0];
		File tarfile = new File("C:/Users/mch/.qrsbox/qrsbox.conf");
		
		switch(parm){
			case "mchweb":{
				coverfile(new File("./conf/mchweb-qrsbox.conf"),tarfile);
				break;
			}
			case "zmcweb":{
				coverfile(new File("./conf/zmcweb-qrsbox.conf"),tarfile);
				break;
			}
			case "meimei8":{
				coverfile(new File("./conf/meimei8-qrsbox.conf"),tarfile);
				break;
			}
			case "meimei6":{
				coverfile(new File("./conf/meimei6-qrsbox.conf"),tarfile);
				break;
			}
		}
	}

	public static void coverfile(File srcfile, File tarfile) throws Exception {
		FileReader fr = new FileReader(srcfile);
		BufferedReader br = new BufferedReader(fr);
		char[] chartmps = new char[512];
		int count = br.read(chartmps);

		FileWriter fw = new FileWriter(tarfile);
		BufferedWriter bw = new BufferedWriter(fw);
		while (count > 0) {
			bw.write(chartmps, 0, count);
			count = br.read(chartmps);
		}
		br.close();
		fr.close();

		bw.flush();
		fw.close();
	}
}
